package com.twu.biblioteca;

import com.twu.biblioteca.services.ILibraryIOService;
import com.twu.biblioteca.services.MenuOption;

import java.util.ArrayList;
import java.util.List;
import java.util.Stack;

public class FakeConsole implements ILibraryIOService {

    private List<String> textDisplayed;
    private Stack<MenuOption> fakeInputOptions;
    private Stack<String> fakeInputText;

    public FakeConsole(){
        this.fakeInputOptions = new Stack<MenuOption>();
        this.fakeInputText = new Stack<String>();
        this.textDisplayed = new ArrayList<String>();
    }

    public void pushFakeInput(MenuOption fakeInput){
        this.fakeInputOptions.push(fakeInput);
    }

    public void pushFakeInput(String textInput) {
         this.fakeInputText.push(textInput);
    }

    @Override
    public void output(String text) {
        this.textDisplayed.add(text);
    }

    public List<String> getTextInDisplay() {
        return this.textDisplayed;
    }

    @Override
    public MenuOption getMenuInput() {
        return fakeInputOptions.pop();
    }

    @Override
    public String getTextInput() {
        return this.fakeInputText.pop();
    }

}
